package com.deeper.customview;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.deeper.customview.databinding.ActivitySourceCodeBinding;

public class SourceCodeActivity extends AppCompatActivity {

    private ActivitySourceCodeBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = ActivitySourceCodeBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        initView();
    }

    private void initView() {
        Intent intent = getIntent();
        String urlFileName = intent.getStringExtra("URL");
        String url = "file:///android_asset/" + urlFileName + ".html";

        binding.webView.getSettings().setJavaScriptEnabled(true);
        binding.webView.loadUrl(url);
    }
}